package com.chb.service;


import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.messaging.Source;
import org.springframework.integration.support.MessageBuilder;
import org.springframework.messaging.MessageChannel;

import javax.annotation.Resource;
import java.util.UUID;

@EnableBinding(Source.class)//定义消息得推送管道
public class IMessageProviderImpl implements IMessageProvider {

    @Resource
    private MessageChannel output;


    @Override
    public String send() {
        String uuid = UUID.randomUUID().toString();

        output.send(MessageBuilder.withPayload(uuid).build());

        System.out.println("******* uuid: "+ uuid);


        return uuid;
    }







}
